# Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.

import os
from waflib import Logs

def build(bld):

	# If Scaleform SDK is available, compile the integration code into CrySystem
	scaleform_file_list = []
	if os.path.isdir(Path('Code/SDKs/Scaleform')):
		scaleform_file_list = ['Scaleform/scaleform.waf_files']
		bld.recurse(['Scaleform'])

	bld.CryEngineModule(
		target      = 'CrySystem',
		vs_filter   = 'CryEngine',
		file_list   = ['crysystem.waf_files'] + scaleform_file_list,
		win_file_list     = ['platformos.waf_files', 'crysystem_win32.waf_files'],
		durango_file_list = ['crysystem_win32.waf_files', 'crysystem_durango.waf_files'],
		linux_file_list   = ['platformos.waf_files', 'crysystem_posix.waf_files'],
		darwin_file_list  = ['platformos.waf_files', 'crysystem_posix.waf_files'],
		android_file_list = ['platformos.waf_files', 'crysystem_posix.waf_files'],
		orbis_file_list   = ['crysystem_sce.waf_files', 'crysystem_sce.waf_files', 'crysystem_posix.waf_files',  'crysystem_orbis.waf_files'],

		pch  = 'StdAfx.cpp',

		android_includes = [ Path('Code/SDKs/SDL2/include/linux'), Path('Code/SDKs/SDL2/include/SDL')],

		linux_module_extensions = [ 'ncurses' ],

		use_module = [
			'zlib',
			'expat',
			'lz4',
			'md5',
			'yasli',
			'tomcrypt'
		],
		win_use_module = [ 'oculus' ],		

		durango_cxxflags  = [ '/EHsc',  '/ZW' ], 

		win_linkflags = [ '/NODEFAULTLIB:libcmt.lib', '/NODEFAULTLIB:libcpmt.lib'],

		win_lib     = [ 'wininet', 'Shell32', 'Ole32', 'Gdi32' ],
		darwin_lib  = [ 'ncurses', 'm'],
		linux_lib   = [ 'm'],
		orbis_lib   = ['SceMsgDialog_stub_weak', 'SceImeDialog_stub_weak'],
		durango_lib = [ 'uuid', 'acphal' ],
		android_lib = [ 'm' ],
		
		durango_meta_includes = Path('Code/SDKs/Microsoft SDKs/Durango.160300/v8.0/ExtensionSDKs/xbox services api/8.0/references/commonconfiguration/neutral')
	)	
